package com.chushouya.order.constants;


import com.general.framework.core.enums.IEnum;
import com.general.framework.core.lang.Strings;

import java.util.Objects;

public enum OrderPhoneImageTypeEnum implements IEnum<String> {

    PHONE_FRONT("phoneFront", "手机-正面照片（黑屏）", "front"),
    PHONE_REVERSE("phoneReverse", "手机-背面照片", "back"),
    PHONE_LEFT("phoneLeft", "手机-左侧面照片", "left"),
    PHONE_RIGHT("phoneRight", "手机-右侧面照片", "right"),
    PHONE_TOP("phoneTop", "手机-顶部照片", "top"),
    PHONE_BOTTOM("phoneBottom", "手机-底部照片", "bottom"),
    IMEI("imei", "IMEI号照片", "imei"),
    ACCOUNT_UNLOCK("accountUnlock", "云账号解锁图", "account"),
    MODEL_NUMBER("modelNumber", "型号号码图", "model"),
    MODEL_DETAIL("modelDetail", "Model号号码图", "modelDetail");



    private String value;

    private String desc;

    //位置
    private String position;

    OrderPhoneImageTypeEnum(String value, String desc, String position) {
        this.value = value;
        this.desc = desc;
        this.position = position;
    }

    public static String getDesc(String value) {
        for (OrderPhoneImageTypeEnum thisEnum : OrderPhoneImageTypeEnum.values()) {
            if (Objects.equals(thisEnum.value, value)) {
                return thisEnum.desc;
            }
        }
        return Strings.EMPTY;
    }

    public static String getValue(String position){
        for (OrderPhoneImageTypeEnum thisEnum : OrderPhoneImageTypeEnum.values()) {
            if (Objects.equals(thisEnum.position, position)) {
                return thisEnum.value;
            }
        }
        return Strings.EMPTY;
    }

    public static String getPosition(String value) {
        for (OrderPhoneImageTypeEnum thisEnum : OrderPhoneImageTypeEnum.values()) {
            if (Objects.equals(thisEnum.value, value)) {
                return thisEnum.position;
            }
        }
        return Strings.EMPTY;
    }

    @Override
    public String value() {
        return this.value;
    }

    @Override
    public String named() {
        return this.desc;
    }


}
